home *** CD-ROM | disk | FTP | other *** search
/ Clickx 63 / Clickx 63.iso / software / multimedia / mirov204 / Miro_Installer.exe / xulrunner / chrome / toolkit.jar / content / global / configIntValue.xul < prev    next >
Encoding:
Extensible Markup Language  |  2007-06-08  |  2.3 KB  |  72 lines

  1. <?xml version="1.0"?>
  2.  
  3. <?xml-stylesheet href="chrome://global/skin/config.css" type="text/css"?>
  4.  
  5. <!DOCTYPE dialog SYSTEM "chrome://global/locale/config.dtd">
  6.  
  7. <dialog id="intValueDialog"
  8.         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" 
  9.         ondialogaccept="return onIntValueDialogOK();"
  10.         ondialogcancel="return onIntValueDialogCancel();"
  11.         onload="onIntValueDialogLoad();"
  12.         buttonpack="center"
  13.         style="min-width: 29em; min-height: 10em;">
  14.  
  15. <script type="application/x-javascript">
  16.   <![CDATA[
  17.     var gIntValueDialogParams;
  18.     function onIntValueDialogLoad()
  19.     {
  20.       gIntValueDialogParams = window.arguments[0];
  21.       document.title = gIntValueDialogParams.windowTitle;
  22.       var label = document.getElementById("label");
  23.       label.value = gIntValueDialogParams.label;
  24.       var textbox = document.getElementById("textbox");
  25.       textbox.value = gIntValueDialogParams.value;
  26.       validateIntValue();
  27.     }
  28.     
  29.     function onIntValueDialogOK()
  30.     {
  31.       // XXX Validate one more time because there are ways to change
  32.       // the text that does not trigger 'oninput' such as drag-n-drop
  33.       // (bug 128066) and autocomplete (bug 320462).
  34.       if (!validateIntValue())
  35.         return false;
  36.       gIntValueDialogParams.cancelled = false;
  37.       return true;
  38.     }
  39.     
  40.     function onIntValueDialogCancel()
  41.     {
  42.       gIntValueDialogParams.cancelled = true;
  43.       return true;
  44.     }
  45.     
  46.     function validateIntValue()
  47.     {
  48.       // We intentionally don't want to support octal/hex numbers here (bug 63117).
  49.       var value = document.getElementById("textbox").value;
  50.       var intValue = parseInt(value, 10);
  51.       var valid = !isNaN(value) && value == intValue.toString() && (value | 0) == intValue;
  52.       if (valid)
  53.         gIntValueDialogParams.value = intValue;
  54.       var okButton = document.documentElement.getButton("accept");
  55.       okButton.disabled = !valid;
  56.       return valid;
  57.     }
  58.   ]]>
  59. </script>
  60.  
  61.  
  62.   <hbox flex="1">
  63.     <hbox align="start"><image class="spaced question-icon"/></hbox>
  64.     <vbox flex="1">
  65.       <description/> <!-- dummy to get the same spacing as string value prompt -->
  66.       <label id="label" control="textbox"/>
  67.       <label value=""/> <!-- dummy to get the same spacing as string value prompt -->
  68.       <textbox id="textbox" oninput="validateIntValue()"/>
  69.     </vbox>
  70.   </hbox>
  71. </dialog>
  72.